import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i<n;i++) {
            arr[i] = scanner.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(count(arr,0,1,0,n));
    }
    public static int count(int[] arr,int sum,int mul,int pos,int n) {
        int count = 0;
        for(int i = pos;i<n;i++) {
            sum+=arr[i];
            mul*=arr[i];
            if(sum>mul) {
                count+=1+count(arr,sum,mul,i+1,n);
            }else if(arr[i] == 1) {
                count+=count(arr,sum,mul,i+1,n);
            }else {
                break;
            }
            sum-=arr[i];
            mul/=arr[i];
            while(i<n-1 && arr[i] == arr[i+1]) {
                i++;
            }
        }
        return count;
    }
}